#!/bin/bash

cur_interface=$(ip route show default | awk '/default/ {print $5}')
cur_mac=$(ifconfig $cur_interface | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}')

inter=$cur_interface

echo "Changing the MAC-address for your current interface : $cur_interface($cur_mac)"
echo "Make random MAC address"
echo "Performing actions, please wait.."

macchanger -s $inter > /dev/null 2>&1
ifconfig $inter down > /dev/null 2>&1

macchanger -r $inter > /dev/null 2>&1
ifconfig $inter up > /dev/null 2>&1

macchanger -s $inter > /dev/null 2>&1

newmac=$(ifconfig $inter | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}')

echo "Your new mac-address is $newmac"
